package myapps.ttclient.protocol.message;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import myapps.ttclient.GlobalVariables;
import myapps.ttclient.Helper;
import myapps.ttclient.baseclass_and_interface.TTClientMessage;


public class MouseClickMessage extends TTClientMessage
{
	public static final int BUTTON_LEFT = 1;
	public static final int BUTTON_MIDDLE = 2;
	public static final int BUTTON_RIGHT = 3;
	
	
	public static final int STATE_DOWN = 1;
	public static final int STATE_UP = 2;
	public static final int STATE_DOWNUP = 3;
	
	public String temporaryKey = "";
	
	public int button;
	
	public int state;
	
	
	public MouseClickMessage(String temporaryKey, int button, int state)
	{
		this.temporaryKey = temporaryKey;
		this.button = button;
		this.state = state;
	}
	
	public static TTClientMessage parse(DataInputStream dis) throws IOException
	{
		throw new IOException("NOtImplemented");
	}
	
	@Override
	public void toDataOutputStream(DataOutputStream dos) throws IOException
	{
		dos.writeByte(MOUSE_CLICK);
		dos.writeInt(GlobalVariables.NO_LENGTH_CODE);
		
		
		Helper.WriteStringToDataOutputStream(dos, this.temporaryKey);
		
		dos.writeByte(this.button);
		dos.writeByte(this.state);
	}
}
